package com.yanqu.road.server.cmd.wingroom.message;

import com.yanqu.road.pb.wingroom.WingRoomProto;
import com.yanqu.road.server.command.Cmd;
import com.yanqu.road.server.command.Command;
import com.yanqu.road.server.logic.MessageHelper;
import com.yanqu.road.utils.YanQuMessageUtils;
import com.yanqu.road.message.YanQuMessage;
import com.yanqu.road.server.protocol.CrossProtocol;
import com.yanqu.road.server.protocol.GameProtocol;
import io.netty.channel.ChannelHandlerContext;

/**
 * @author ：zfr
 * @date ：2022/3/20 2:16
 */
@Cmd(code = CrossProtocol.C_WING_ROOM_GIVE_LIKE_RESP, desc = "点赞返回")
public class CrossGiveLikeRespCmd implements Command {
    @Override
    public void execute(ChannelHandlerContext ctx, YanQuMessage packet) throws Exception {
        WingRoomProto.GiveLikeRespCrossMsg respCrossMsg = WingRoomProto.GiveLikeRespCrossMsg.parseFrom(packet.getBytes());
        WingRoomProto.GiveLikeCrossRespMsg.Builder crossRespMsg = WingRoomProto.GiveLikeCrossRespMsg.newBuilder();
        crossRespMsg.setOwnerServerId(respCrossMsg.getOwnerServerId());
        crossRespMsg.setOwnerUserId(respCrossMsg.getOwnerUserId());
        crossRespMsg.setRespMsg(respCrossMsg.getRespMsg());
        YanQuMessage message = YanQuMessageUtils.buildMessage(GameProtocol.S_WING_ROOM_CROSS_GIVE_LIKE_RESP, crossRespMsg);
        MessageHelper.sendPacket(respCrossMsg.getGuestServerId(), respCrossMsg.getGuestUserId(), message);
    }
}
